home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_mod.cpp < prev    next >
C/C++ Source or Header  |  1996-03-17  |  9KB  |  312 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5.  
  6. #include "eurodefs.h"
  7. #include "euro_fxd.h"
  8. #include "euro.equ"
  9. #include "euro_sym.h"
  10. #include "euro_def.h"
  11. #include "euro_var.h"
  12. #include "euro_gen.h"
  13. #include "euro_grf.h"
  14. #include "euro_dsk.h"
  15. #include "euro_fix.h"
  16. #include "euro_sel.h"
  17. #include "euro_inf.h"
  18. #include "euro_cnt.h"
  19. #include "euro_usr.h"
  20. #include "euro_net.h"
  21. #include "euro_inp.h"
  22. #include "euro_spt.h"
  23. #include "euro_int.h"
  24.  
  25. #include "defines.h"
  26.  
  27.  
  28. //********************************************************************************************************************************
  29.  
  30. short    DisplayModemSetupPanel()
  31.     {
  32.         short    x;
  33.  
  34.         DisplayString( 36, 132,    GetTEXT( MODM_LBLS+Initialisation ), LARGE_FONT, 29, NO_BOX,
  35.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  36.  
  37.         DisplayString( 36, 306,    GetTEXT( MODM_LBLS+Typeheading ), LARGE_FONT, 29, NO_BOX,
  38.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  39.  
  40.  
  41.  
  42.         DisplayString( 36, 165,    GetTEXT( MODM_LBLS+Type ), MEDIUM_FONT, 22, MODEM_SELECT_BOX,
  43.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  44.       
  45.         Bounding_table[ MODEM_SELECT_BOX ].BoundingBoxRight = 400;
  46.         x = NextXposn;
  47.  
  48.         DisplayString( 36, 209,    GetTEXT( MODM_LBLS+Dial ), MEDIUM_FONT, 22, DIAL_SELECT_BOX, 
  49.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  50.         Bounding_table[ DIAL_SELECT_BOX ].BoundingBoxRight = 400;
  51.  
  52.         if ( NextXposn > x )
  53.             x = NextXposn;
  54.  
  55.         DisplayString( 36, 187,    GetTEXT( MODM_LBLS+Comport ), MEDIUM_FONT, 22, COM_SELECT_BOX, 
  56.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  57.  
  58.         Bounding_table[ COM_SELECT_BOX ].BoundingBoxRight = 400;
  59.  
  60.         if ( NextXposn > x )
  61.             x = NextXposn;
  62.  
  63.         DisplayString( 36, 231,    GetTEXT( MODM_LBLS+Initstring ), MEDIUM_FONT, 22, INIT_STRING_BOX, 
  64.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  65.  
  66.         if ( NextXposn > x )
  67.             x = NextXposn;
  68.  
  69.         DisplayString( 36, 253,    GetTEXT( MODM_LBLS+Phonenumber ), MEDIUM_FONT, 22, NO_BOX, 
  70.             &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  71.  
  72.         if ( NextXposn > x )
  73.             x = NextXposn;
  74.  
  75.         return(x+16);
  76.     }
  77.  
  78. //********************************************************************************************************************************
  79.  
  80. void    DisplayModemList( char MODEM )
  81.  
  82.     {
  83.         int    PAL;
  84.  
  85.         CopyFromBACKtoPSEUDObuffer(
  86.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  87.                 48, 340, 290, 18*6 );
  88.  
  89.           for ( char m=0; m < 6; m ++ )
  90.         {
  91.             if ( (MODEM+m) == EUROmodemType )
  92.                 PAL = 15;
  93.             else            
  94.                 PAL = 22;
  95.  
  96.             DisplayString( 48, 340+(m*18),    
  97.                 (char *)Modems[ MODEM+m ], 
  98.                 SMALL_FONT, PAL, m, 
  99.                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  100.             Bounding_table[m].BoundingBoxRight = 360;
  101.         }
  102.  
  103.         AddToDumpList( 48, 340, 290, 18*6 );
  104.     }
  105.  
  106. //********************************************************************************************************************************
  107.  
  108. void    InitialiseInitString( signed short MODEM )
  109.     {
  110.         char    *m = (char *)ModemInitStrs[ ModemInitList[MODEM] ];
  111.          strcpy( &InitStr[0], m );
  112.     }
  113.     
  114. //********************************************************************************************************************************
  115.  
  116. void    DisplayInitString()
  117.     {
  118.         CopyFromBACKtoPSEUDObuffer(
  119.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  120.                 ModemXposn, 234, INIT_LENGTH+16, 18 );
  121.  
  122.         DisplayString( ModemXposn, 234,    
  123.             &InitStr[0], 
  124.             SMALL_FONT, 15, NO_BOX, 
  125.             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  126.  
  127.         AddToDumpList( ModemXposn, 234, INIT_LENGTH+16, 18 );
  128.         Bounding_table[INIT_STRING_BOX].BoundingBoxRight = 36+ModemXposn+INIT_LENGTH;
  129.     }
  130.  
  131. //********************************************************************************************************************************
  132.  
  133. void    DisplayModemType()
  134.     {
  135.         CopyFromBACKtoPSEUDObuffer(
  136.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  137.                 ModemXposn, 168, 290, 18 );
  138.  
  139.         DisplayString( ModemXposn, 168,    
  140.             (char *)Modems[ EUROmodemType], 
  141.             SMALL_FONT, 15, MODEM_SELECT_BOX, 
  142.             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  143.  
  144.         AddToDumpList( ModemXposn, 168, 290, 18 );
  145.     }
  146.  
  147. //********************************************************************************************************************************
  148.  
  149. void    DisplayDialSetting()
  150.     {
  151.         CopyFromBACKtoPSEUDObuffer(
  152.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  153.                 ModemXposn, 212, 100, 18 );
  154.         DisplayString( ModemXposn, 212,    GetTEXT( DIAL_LBLS+EUROmodemDialType ), SMALL_FONT, 15, DIAL_SELECT_BOX, 
  155.             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  156.         AddToDumpList( ModemXposn, 212, 100, 18 );
  157.     }
  158.  
  159. //********************************************************************************************************************************
  160.  
  161. void    DisplayCommSetting()
  162.     {
  163.         CopyFromBACKtoPSEUDObuffer(
  164.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  165.                 ModemXposn, 190, 100, 18 );
  166.         DisplayString( ModemXposn, 190,    GetTEXT( CMPT_LBLS+EUROmodemCommType ), SMALL_FONT, 15, COM_SELECT_BOX, 
  167.             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  168.         AddToDumpList( ModemXposn, 190, 100, 18 );
  169.     }
  170.  
  171. //********************************************************************************************************************************
  172.  
  173. void    DisplayTelephoneNumber()
  174.     {
  175.         CopyFromBACKtoPSEUDObuffer(
  176.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  177.                 ModemXposn, 256, DIAL_LENGTH+16, 18 );
  178.  
  179.         DisplayString( ModemXposn, 256,    
  180.             &DialNumber[0], 
  181.             SMALL_FONT, 15, DIAL_NUMBER_BOX, 
  182.             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  183.  
  184.         AddToDumpList( ModemXposn, 256, DIAL_LENGTH+16, 23 );
  185.  
  186.         Bounding_table[DIAL_NUMBER_BOX].BoundingBoxRight = 36+ModemXposn+DIAL_LENGTH;
  187.     }
  188.  
  189. //********************************************************************************************************************************
  190.  
  191. void    DoModemSetup( char MENU, signed char BOX )
  192.     {
  193.         if ( MENU == MODEM_SETUP && LogicState == RUN_FRONTEND)
  194.         {
  195.             char    ReprintList    =    No;
  196.  
  197.             short    oldpage    = ModemYpage;
  198.                 ModemSelectDEFN.elements = Modemcount;
  199.                 ModemYpage = ControlSlider( &ModemSelectDEFN, SelectorXcoord, SelectorYcoord, ButtonState );
  200.  
  201.             if ( oldpage != ModemYpage )
  202.                 ReprintList    =    Yes;
  203.  
  204. //            if ( ((BOX >= 0 && BOX <8) || ( BOX == MODEM_SELECT_BOX)) && ButtonState != 0 )
  205.  
  206.  
  207.             if ( (BOX >= 0 && BOX <8) && ButtonState != 0 )
  208.             {
  209.                 if ( (BOX >= 0 && BOX <8) )
  210.                     EUROmodemType = ModemYpage+BOX;
  211. //            else
  212. //                {
  213. //                          if ( ButtonState == LEFT_BUTTON )
  214. //                        EUROmodemType--;
  215. //                          if ( ButtonState == RIGHT_BUTTON )
  216. //                        EUROmodemType++;
  217. //                    if ( EUROmodemType < 0 )
  218. //                        EUROmodemType = 0;
  219. //                    if ( EUROmodemType >= Modemcount )
  220. //                        EUROmodemType = Modemcount-1;
  221. //                }                                     
  222.  
  223.                 DisplayModemType();
  224.                 InitialiseInitString( EUROmodemType );
  225.                 DisplayInitString();
  226.                 ReprintList    =    Yes;
  227.                      DeBounce      =     TRUE;
  228.             }
  229.  
  230.  
  231.             if ( ReprintList==Yes )
  232.                 DisplayModemList( ModemYpage );
  233.             
  234.              
  235.             if ( BOX == DIAL_SELECT_BOX && ButtonState != 0 )
  236.             {
  237.                     EUROmodemDialType^=    1;
  238.                     DisplayDialSetting();
  239.                          DeBounce      =     TRUE;
  240.             }                                     
  241.              
  242.             if ( BOX == COM_SELECT_BOX && ButtonState != 0 )
  243.             {
  244.                     if ( ButtonState != LEFT_BUTTON )
  245.                         EUROmodemCommType++;
  246.                     if ( ButtonState != RIGHT_BUTTON )
  247.                         EUROmodemCommType--;
  248.                     EUROmodemCommType&=    3;
  249.                     DisplayCommSetting();
  250.                          DeBounce      =     TRUE;
  251.             }                                     
  252.  
  253.  
  254.  
  255.  
  256.             if ( BOX == DIAL_NUMBER_BOX && ButtonState != 0 && EuroTextEditState == 0 )
  257.             {
  258.                     DialX    =  strlen ( &DialNumber[0] );
  259.                     EuroTextEditState = EDIT_DIAL_NUMBER;
  260.                          DeBounce      =     TRUE;
  261.             }                                     
  262.  
  263.             if ( BOX == INIT_STRING_BOX && ButtonState != 0 && EuroTextEditState == 0 )
  264.             {
  265.                     InitX    =  strlen ( &InitStr[0] );
  266.                     EuroTextEditState = EDIT_INIT_STRING;
  267.                          DeBounce      =     TRUE;
  268.             }                                     
  269.  
  270.                         
  271.             if ( EuroTextEditState == EDIT_DIAL_NUMBER )
  272.             {
  273.                 char    f;
  274.         
  275.                 if ( PixelLengthOfString(&DialNumber[0],SMALL_FONT) >= DIAL_LENGTH )
  276.                     f = DISABLE_INPUT;
  277.                 else                            
  278.                     f = ENABLE_INPUT;
  279.             
  280.                 DialX    =    DoTextINPUT( &DialNumber[0], DialX, 30, DIAL, f );
  281.                        strcpy( &DialNumber[0], TextEditBuffer );
  282.                 DisplayTelephoneNumber();
  283.     
  284.                 if ( EuroTextEditState == EDIT_DIAL_NUMBER )
  285.                     DisplayTextInputCursor( ModemXposn, DialX, 256,
  286.                         &DialNumber[0],    SMALL_FONT, 15,    
  287.                             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  288.             }
  289.  
  290.             if ( EuroTextEditState == EDIT_INIT_STRING )
  291.             {
  292.                 char    f;
  293.         
  294.                 if ( PixelLengthOfString(&InitStr[0],SMALL_FONT) >= INIT_LENGTH )
  295.                     f = DISABLE_INPUT;
  296.                 else                            
  297.                     f = ENABLE_INPUT;
  298.             
  299.                 InitX    =    DoTextINPUT( &InitStr[0], InitX, 64, NORMAL, f );
  300.                        strcpy( &InitStr[0], TextEditBuffer );
  301.                 DisplayInitString();
  302.     
  303.                 if ( EuroTextEditState == EDIT_INIT_STRING )
  304.                     DisplayTextInputCursor( ModemXposn, InitX, 234,
  305.                         &InitStr[0], SMALL_FONT, 15,    
  306.                             &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  307.             }
  308.         }
  309.     }
  310.  
  311. //********************************************************************************************************************************
  312.